n = int(input())
List = [list(map(float, input().split())) for i in range(n)]
lines, sumrows, rows = [], [], []
flag = True

for i in range(n):
    lines.append(sum(List[i]))
    for row in List: 
        rows.append(row[i])
        if len(rows) == n:
            sumrows.append(sum(rows))
            rows = []

for i in range(len(lines)):
    if lines[i] != 1:
        flag = False
        break
for j in range(len(rows)):
    if rows[j] != 1:
        flag = False
        break

if flag:
    print("yes")
else:
    print("no")